﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using System.Xml;
using System.Runtime.Serialization;

public partial class ArrayOfJobClass
{
    public static ArrayOfJobClass Load(string FileName)
    {
        if (File.Exists(FileName))
        {
            using (StreamReader sr = new StreamReader(FileName))
            {
                using (XmlTextReader xr = new XmlTextReader(sr))
                {
                    XmlSerializer xs = new XmlSerializer(typeof(ArrayOfJobClass));
                    if (xs.CanDeserialize(xr))
                    {
                        return xs.Deserialize(xr) as ArrayOfJobClass;
                    }
                    else
                    {
                        throw new SerializationException();
                    }
                }
            }
        }
        else
        {
            throw new FileNotFoundException("File does not exist", FileName);
        }
    }
}
